﻿package com.tangchao.client.sdh.control
{
	import com.tangchao.client.sdh.event.LoginEvent;
	
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	import flash.text.TextField;

	public class LogIn extends MovieClip
	{
		private var _name:TextField;
		private var _passWord:TextField;
		private var _tipText:TextField;
		private var _btLogIn:SimpleButton;
		public function LogIn()
		{
			init();
		}
		
		private function init()
		{
			_name  = getChildByName("tfName") as TextField;
			_passWord=getChildByName("tfPassword") as TextField;
			_tipText=getChildByName("tfTip") as TextField;
			_btLogIn=getChildByName("btLogIn") as SimpleButton;
			_btLogIn.addEventListener(MouseEvent.CLICK,onLoginGame);
		}
		
		private function onLoginGame(e:MouseEvent)
		{
			var evt:LoginEvent=new LoginEvent();
			evt.userName=_name.text;
			evt.passWord=_passWord.text;
			dispatchEvent(evt);
			
			_tipText.text="登陆中，请等待。。。"
		}
	}
}